﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class MP_FieldPositions : System.Web.UI.Page
    {
        IFieldBLL fieldBLL = new FieldBLL();

        private object _dataItem = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RadTabStrip1.SelectedIndex = 0;
                AddPageView(RadTabStrip1.SelectedTab);
                RadMultiPage1.PageViews[0].Selected = true;
            }
        }

        public object DataItem
        {
            get
            {
                return this._dataItem;
            }
            set
            {
                this._dataItem = value;
            }
        }

        private void AddTab(string tabName)
        {
            RadTab tab = new RadTab();
            tab.Value = tabName;
            RadTabStrip1.Tabs.Add(tab);
        }

        protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
        {
            string userControlName = "../UserControls/" + e.PageView.ID + ".ascx";

            Control userControl = Page.LoadControl(userControlName);
            userControl.ID = e.PageView.ID + "_userControl";

            e.PageView.Controls.Add(userControl);
        }

        private void AddPageView(RadTab tab)
        {
            RadPageView pageView = new RadPageView();
            pageView.ID = tab.Value;
            RadMultiPage1.PageViews.Add(pageView);
            tab.PageViewID = pageView.ID;
        }

        protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
        {
            RadMultiPage1.PageViews.Clear();
            AddPageView(e.Tab);
            e.Tab.PageView.Selected = true;
        }


        protected void cmdSearch_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void cmdExpand_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void cmdCollapse_Click(object sender, ImageClickEventArgs e)
        {

        }

        protected void RadTreeView1_NodeDataBound(object sender, RadTreeNodeEventArgs e)
        {

        }

        protected void RadTreeView1_NodeClick(object sender, RadTreeNodeEventArgs e)
        {

        }

        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            
            if (e.CommandName == "RowClick" && e.Item is GridDataItem)
            {
                RadMultiPage1.PageViews[0].Selected = true;

                e.Item.Selected = true;
                //PanelDetail.Enabled = (RadGrid1.SelectedItems.Count > 0);
                string FieldPosSeq = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["field_pos_seq"].ToString();
                Session["FieldPosSeq"] = FieldPosSeq;

                //DataSet ds = field.GetFieldPositionsBySeq(Int32.Parse(FieldPosSeq));

                //lblEmpType.Text = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["field_pos_seq"].ToString();
                //lblPosType.Text = "POS_TYPE_NAME"; // Convert.ToString(DataBinder.Eval(DataItem, "POS_TYPE_NAME"));
                //lblFieldGroup.Text = Convert.ToString(DataBinder.Eval(DataItem, "FIELD_GROUP_DESCR"));
                //lblClassSpec.Text = Convert.ToString(DataBinder.Eval(DataItem, "CLASS_SPEC_NAME"));
                //lblFieldName.Text = Convert.ToString(DataBinder.Eval(DataItem, "FIELD_POS_NAME"));
                //lblClassificationName.Text = Convert.ToString(DataBinder.Eval(DataItem, "FIELD_POS_NAME_ENG"));
                //lblFieldLine.Text = Convert.ToString(DataBinder.Eval(DataItem, "FIELD_POS_LINE"));
                //lblClassificationTitle.Text = Convert.ToString(DataBinder.Eval(DataItem, "FIELD_POS_LINE_ENG"));
                //lblRemarks.Text = Convert.ToString(DataBinder.Eval(DataItem, "REMARKS"));
            }

            //if (RadMultiPage1.SelectedIndex >= 0)
            //{
            //    RadMultiPage1.PageViews.Clear();
            //    AddPageView(RadTabStrip1.SelectedTab);
            //    RadMultiPage1.PageViews[0].Selected = true;
            //}
        }

        protected void cmbEmpType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void cmbPosType_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
        {

        }

        protected void btnAddnew_Click(object sender, EventArgs e)
        {

        }

        protected void btnUpdate_Click(object sender, EventArgs e)
        {

        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {

        }

    }
}
